package cn.ultrarisk.scadmin.manager.biz.common.dao;

import cn.ultrarisk.mybatis.extension.domain.Page;
import cn.ultrarisk.mybatis.extension.query.Query;
import cn.ultrarisk.scadmin.manager.biz.common.entity.SchedulerJob;
import cn.ultrarisk.scadmin.manager.support.BaseDAO;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 调度管理数据操作类
 *
 * @author sevendlong(lin23871@163.com)
 * @date 2014/3/28
 * @since V1.0
 */
@Repository
public class SchedulerJobDAO extends BaseDAO<SchedulerJob, Integer> {
    /**
     * 构造器
     */
    public SchedulerJobDAO() {
        super(SchedulerJob.class, SchedulerJob.COLUMN_PROPERTY_MAP);
    }

    public List<SchedulerJob> findList(Integer status) {
        Query query = Query.query(SchedulerJob.STATUS, status);
        return findList(query);
    }

    public Page<SchedulerJob> findPage(String name, String remark, Integer status, int pageNo, int pageSize) {
        Query query = Query.query(SchedulerJob.STATUS, status).likeFull(SchedulerJob.NAME, name).likeFull(SchedulerJob.REMARK, remark);
        return findPage(query, pageNo, pageSize);
    }
}
